package com.zhl.spring.user.service.impl;

import com.zhl.spring.user.dao.UserDao;
import com.zhl.spring.user.dao.impl.UserDaoImpl;
import com.zhl.spring.user.entity.User;
import com.zhl.spring.user.service.UserService;
import org.springframework.transaction.support.TransactionTemplate;

import javax.annotation.Resource;

/**
 * @author zhl
 * @date 2021/1/20 19:27
 */
public class UserServiceImpl implements UserService {

    @Resource
    private UserDao userDao;

    @Resource
    private TransactionTemplate transactionTemplate;

    public int save(User user) {
       return userDao.save(user);
    }

    public int delete(int id) {
       return userDao.delete(id);
    }

    public void setUserDao(UserDaoImpl userDao) {
        this.userDao = userDao;
    }

    public void setTransactionTemplate(TransactionTemplate transactionTemplate) {
        this.transactionTemplate = transactionTemplate;
    }
}
